package com.example.demo.controller;

import com.example.demo.pojo.Order;
import com.example.demo.service.ConsumerService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("consumer")
@RestController
public class ConsumerController {

    @Resource
    private ConsumerService consumerService;

    @RequestMapping("bug_book/{userId}/{bookId}/{num}")
    @ResponseBody
    public String bugBook(@PathVariable("userId") Integer userId,
                          @PathVariable("bookId") Integer bookId,
                          @PathVariable("num") Integer num){

        consumerService.bugBook(new Order(userId, bookId, num));
        return "";
    }

}
